#encoding:utf8

"""
django will cache QuerySet result by default, use this to update result

see : http://stackoverflow.com/questions/3346124/how-do-i-force-django-to-ignore-any-caches-and-reload-data
"""

from django.db import connection
from django.db import transaction

#
# @transaction.commit_manually
# def flush_transaction():
#     """
#     Flush the current transaction so we don't read stale data
#
#     Use in long running processes to make sure fresh data is read from
#     the database.  This is a problem with MySQL and the default
#     transaction mode.  You can fix it by setting
#     "transaction-isolation = READ-COMMITTED" in my.cnf or by calling
#     this function at the appropriate moment
#     """
#     transaction.commit()


def commit_transaction():
    transaction.commit()


def close_connection():
    connection.close()